﻿package com.victim.snake.util {
	import flash.display.Graphics;
	import flash.display.Bitmap;
	import flash.filters.BlurFilter;
	import flash.filters.BitmapFilterQuality;
	import flash.display.Sprite;
	
	
	public class Image {

		public function Image() {
			// constructor code
		}
		
		//图片加圆角(用遮罩)
		static public function getRoundImage(bitMap:Bitmap,ellipse:Number):Sprite{			
			var s:Sprite=new Sprite();			
			
			bitMap.cacheAsBitmap=true;
			s.addChildAt(bitMap,0);
			
			var sprite:Sprite=new Sprite();
			sprite.graphics.beginFill(0x66a100);
			sprite.graphics.drawRoundRect(bitMap.x,bitMap.y,bitMap.width,bitMap.height,ellipse,ellipse);
			sprite.graphics.endFill();
			//用滤镜模糊化
            //sprite.filters = [new BlurFilter(10, 1, BitmapFilterQuality.HIGH)];
            sprite.cacheAsBitmap = true;
            
            s.addChild(sprite);    
            
            //遮罩圆可拖拽
           // sprite.startDrag(true);
			
			bitMap.mask=sprite;
			return s;
		}

	}
	
}
